<template>
	<view class="content">
		<view style="page_header">
			<navTop :show="false" @search="search($event,1)" :showhead="false"></navTop>
		</view>
		<view class="box">
			
			<view style="display: flex;padding: 10upx 20upx;font-size: 30upx;background-color: #838285;color: #FFFFFF;" >
							<view style="flex: 4;">
								品名
							</view>
							<view style="flex: 3;padding-left: 15upx;" >
								<view style="margin-left: 10upx;">
									参考价
									<!-- <uni-icons  :type="forbid" size="10" color="#FFFFFF" /> -->
								</view>
							</view>
							<view style="flex: 2;padding-left: 15upx;" >
									<view style="margin-left: 30upx;">
									涨跌
									<!-- <uni-icons  :type="forbid1" size="10" color="#FFFFFF" /> -->
									</view>
									
							</view>	
							<view style="flex: 2;padding-left: 15upx;" >
									<view style="float: right;">
									涨幅
									<!-- <uni-icons  :type="forbid2" size="10" color="#FFFFFF" /> -->
									
									
									</view>
							</view>	
							
						</view>
						
				<view style="display: flex;padding: 20upx 20upx;font-size: 30upx;" 
				v-for="item in tableList" :key="item.id" @click="navToInfo(item.id)">
				
								<view style="flex: 4;">
									{{item.name}}
								
								</view>
								<view style="flex: 3;padding-left: 15upx;">
									<text style="margin-left: 10upx;">¥{{item.price}}</text>
								</view>
								<view style="flex: 2;padding-left: 15upx;">
										<text v-if="item.updown" style="margin-left: 30upx;">{{item.updown}}</text>
										<text v-else style="margin-left: 30upx;">0</text>
								</view>	
								<view style="flex: 2;padding-left: 15upx;">
										<text v-if="item.upp" style="float: right;color: #A22C32;">{{item.upp}}%</text>
										<text v-else style="float: right;color: #A22C32;">0%</text>
									 
								</view>	
						
							</view>
						
			
			
			
			<!-- <t-table @change="change">
				<t-tr>
					<t-th>品名</t-th>
					<t-th>参考价</t-th>
					<t-th>涨跌</t-th>
					<t-th>涨幅</t-th>
				</t-tr>
			
				<view v-for="item in tableList" :key="item.id">
					
				<navigator :url="'/pages/quotes/detail?id='+item.id">
				<t-tr  >
				
					<t-td >{{ item.name }}</t-td>
					<t-td>{{ item.price }}</t-td>
					
					<t-td v-if="item.updown" style="color: #a22c32;">{{ item.updown }}</t-td>
					<t-td v-else style="color: #a22c32;">0</t-td>
					
					<t-td v-if="item.upp" style="color: #a22c32;">{{ item.upp }}%</t-td>	
					<t-td v-else style="color: #a22c32;">0%</t-td>	
					
				</t-tr>
				</navigator>
				</view>
				
				
			</t-table> -->
			
			
			
			
		</view>
		
		
		
	</view>
</template>

<script>
	
import tTable from '@/components/t-table/t-table.vue';
import tTh from '@/components/t-table/t-th.vue';
import tTr from '@/components/t-table/t-tr.vue';
import tTd from '@/components/t-table/t-td.vue';
	export default {
		components: {
			tTable,
			tTh,
			tTr,
			tTd
		},
		
		data() {
			return {
				tableList: [],
				pname:''
			}
		},
		onLoad(option) {
				this.classid=option.classid
				console.log(this.classid);
				this.loadIndexData();
		},
		onPullDownRefresh() {
				this.loadIndexData();
				//this.initline();
				//this.loadData();
		        setTimeout(function () {
		            uni.stopPullDownRefresh();  //停止下拉刷新动画
		        }, 1000);
		},
		methods: {
			navToInfo(id){
				uni.navigateTo({
					url:'/pages/quotes/detail?id='+id
				})
				
			},
			loadIndexData(){
				
					uni.showLoading({
					    title: '载入中...'
					});
				
					 	const sendData = {
							"classid": this.classid
						
						};
					uni.request({
						url: this.webUrl+'/quoteslistbyid', //仅为示例，并非真实接口地址。
						data: sendData,
						dataType: 'json',
						method: 'GET',
						header: {
							'content-type': 'application/json' // 微信默认就是
						},
						success: res => {
							if (res.statusCode !== 404) {
								//console.log(res.data );
								
								this.tableList=res.data;
								uni.hideLoading();
							} else {
								uni.hideLoading();
								console.log("数据没有");
							}
						}
					});
			},
			
			
			
		}
	}
</script>

<style>

</style>
